﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Chefbook.DataObjects;
using System.Globalization;
using Chefbook.DataAccessLayer;

namespace Chefbook.UserActions
{
    public class MoveRecipeAction : UserActionBase
    {
        private Recipe recipeToMove;
        private Category fromCategory, toCategory;

        public MoveRecipeAction(Recipe recipeToMove, Category fromCategory, Category toCategory)
        {
            this.recipeToMove = recipeToMove;
            this.fromCategory = fromCategory;
            this.toCategory = toCategory;
        }

        public override void DoAction()
        {
            base.DoAction();
            recipeToMove.ChangeCategory(fromCategory, toCategory);
        }

        public override void UndoAction()
        {
            base.UndoAction();
            recipeToMove.ChangeCategory(toCategory, fromCategory);
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentUICulture, "Move Recipe '{0}' from '{1}' to '{2}'", recipeToMove, fromCategory, toCategory);
        }
    }
}
